<?php
/**
 * 项目：红河移动电路资源管理信息系统
 *
 * 公司：红河移动分公司
 *
 * @author 李朝应
 *
 * E-mail:lichaoying.hh@163.com
 *
 */
class Org1_model extends CI_Model {
   function __construct()
    {
        parent::__construct();
    }


   function setOrg1($name,$fzr,$email,$tel,$word){
    $data = array(
               'org1_name' => $name,
               'org1_fzr' => $fzr,
               'org1_email' => $email,
               'org1_tel' => $tel,
               'Receipt_word'=>$word
            );

    $this->db->insert('org1', $data);
    return $this->db->affected_rows() ;

   }
 function updateOrg1($id,$name,$fzr,$email,$tel,$word){
    $data = array(
               'org1_name' => $name,
               'org1_fzr' => $fzr,
               'org1_email' => $email,
               'org1_tel' => $tel,
               'Receipt_word'=>$word
            );
      $this->db->where('org1_id',$id);
      $this->db->update('org1', $data);
    return $this->db->affected_rows() ;
 }
function delOrg1($id){
    $this->db->delete('org1', array('org1_id' => $id));
	return true;
 }

function getCount(){
      return  $this->db->count_all("org1");
   }

 function getOrg1All(){
     $query = $this->db->get('org1');
		if ($query->num_rows() > 0)
		{
			  return $query; //返回查询结果
        }
   }
    function getOrg1($id){
     $this->db->where("org1_id", $id);
     $query = $this->db->get('org1');
		if ($query->num_rows() > 0)
		{
			 return $query->row_array(); //返回查询结果
        }
   }
   function hasOrg1($name){
        $this->db->where("org1_name", $name);
		$query = $this->db->get('org1');
		if ($query->num_rows() > 0)
		{
			return TRUE;
		}else{
           	return FALSE;
        }
   }
    function hasSameRec($id,$name){
        $this->db->where("org1_id !=", $id);
        $this->db->where("org1_name", $name);
		$query = $this->db->get('org1');
		if ($query->num_rows() > 0)
		{
			return TRUE;
		}else{
           	return FALSE;
        }
   }
}//类定义结束
?>
